package cn.kgc.userprovider.service;

import cn.kgc.userprovider.dao.UserDao;
import cn.kgc.userprovider.dao.UserDaoImpl;
import cn.kgc.userprovider.pojo.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName UserService
 * @Description TODO
 * @Author yaozhaobao
 * @Date 2021/1/21 13:59
 * @Version 1.0
 **/
@RestController
public class UserService {

    @Value("${server.port}")
    private String port;


    UserDao  userDao = new UserDaoImpl();

    @RequestMapping(value = "/user/login",method = RequestMethod.POST)
    public User login(@RequestParam String username, @RequestParam String pwd){
        //数据库做校验
        User user =  userDao.valilogin(username,pwd);
        return user;

    }


    @RequestMapping(value = "/user/login2",method = RequestMethod.POST)
    public User login2(@RequestBody User user1){
        //数据库做校验
        User user =  userDao.valilogin(user1.getUsername(),user1.getPwd());
        return user;

    }

    @RequestMapping(value = "/user/userinfo",method = RequestMethod.POST)
    public void userinfo(@RequestParam int count){
        System.out.println("当前的服务是：user-provider:"+port+"用户信息："+count);
    }





}
